package com.effectiveui.away3d.primitives{
	
	import away3d.core.base.Object3D;
	import away3d.core.math.Number3D;
	
	import com.effectiveui.away3d.material.MaterialUtil;
	
	import mx.core.UIComponent;
	
	public class FlexObject3D extends UIComponent{
		public var object3D:Object3D;
		
		protected var _refreshMaterial:Boolean 	= false;
		protected var _material:* 				= "blue#cyan";
		protected var _z:Number 				= 0;
		protected var _rotationY:Number 		= 0;
		protected var _rotationX:Number 		= 0;
		protected var _rotationZ:Number 		= 0;
		protected var _bothsides:Boolean 		= false;
		protected var needUpdate:Boolean 		= false;
		
		public function forceUpdate():void{
			this.needUpdate = true;
			this.invalidateDisplayList();
		}
		
		public function get z():Number{
			return this._z;
		}
		public function set z(value:Number):void{
			this._z = value;
		}
		
		public function get rotationX():Number{
			return this._rotationX;
		}
		
		public function set rotationX(value:Number):void{
			this._rotationX = value;
		}
		
		public function get rotationZ():Number{
			return this._rotationZ;
		}
		
		public function set rotationZ(value:Number):void{
			this._rotationZ = value;
		}
		
		public function get rotationY():Number{
			return this._rotationY;
		}
		
		public function set rotationY(value:Number):void{
			this._rotationY = value;
		}
		
		public function get bothsides():Boolean{
			return this._bothsides;
		}
		public function set bothsides(value:Boolean):void{
			this._bothsides = value;
		}
		
		[Bindable]
		public function get position():Number3D{
			return this.object3D.position;
		}
		
		public function set position(value:Number3D):void{
			this.object3D.position = value;
		}
		
		public function get material():*{
			return this._material;
		}
		
		public function set material(value:*):void{
			this._material = MaterialUtil.getMaterial(value, this );
			this.needUpdate = true;
		}
		
		public function get refreshMaterial():Boolean{
			return this._refreshMaterial;
		}
		
		public function set refreshMaterial(value:Boolean):void{
			this._refreshMaterial = value;
			this.needUpdate = true;
		}

	}
}